package cn.edu.bupt.ch3_1.task;

import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
public class DemoSchedulTask {
    @Scheduled(fixedRate = 5000)
    public void fixedRateDemo() {
        System.out.println("每隔5秒钟执行一次");
    }

    @Scheduled(fixedDelay = 10000)
    public void fixedDelayDemo() {
        System.out.println("在上次执行完成10秒钟后执行");
    }

    @Scheduled(cron = "0 0/30 9-17 * * ?")
    public void cronDemo() {
        System.out.println("早9点到晚5点的工作时间内每30分钟执行一次");
    }

}
